<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">
		<meta charset="UTF-8">
		<title>月利宝详情_共富网_Gofull.com.cn</title>
		<script src="/v3/js/jquery-1.10.2.min.js" type="text/javascript"></script>		
		<link type="text/css" rel="stylesheet" href="/v3/css/wstyle.css">
		<link type="text/css" rel="stylesheet" href="/v3/css/account.css">
	</head>
<style>
</style>
	<body>
		<div id="wrap">
			<div class="product-o">
				<p>每个工作日 10:00、14:00、17:00 更新总额度 </p>
			</div>
			<div class="product-box">
				<ul class="pro-t">
					<li class="pro-amount">
						<p>总额度</p>
						<span>￥	20,000,000</span>
					</li>
					<li class="pro-rate">
						<p>年化收益率</p>
						<span>13<em>.47%</em></span>
					</li>
					<li class="pro-limit">
						<p>投资期限</p>
						<span>1个月</span>
					</li>
				</ul>
				<div class="pro-expl">
					<div class="pro-remain">剩余金额 <em>￥10086</em></div>
					<div class="pro-ratio-per">
						<div class="per" data-rel="70.00">
								<div style="width: 70.00%"></div>
						</div>
						<strong>当前进度 70.00%</strong>
					</div>
				</div>				
			</div>
			<ul class="pro-info">
					<li><p>起投金额</p><span>50元起投</span></li>
					<li><p>单笔额度上限 </p><span>不超过月利宝总额度 </span></li>
					<li><p>保障方式 </p><span><i class="icon-safe"></i>100% 本息担保</span></li>
					<li><p>产品说明</p><span onclick="location.href='wchatProductDescription.do?pid=${productDetailMap.pid }&productType=2'"><i class="icon-next"></i></span></li>
					<li><p>投资记录</p><span onclick="location.href='/ylbInvestRecord.do?pid=${productDetailMap.pid }'"><i class="icon-next"></i></span></li>
					<li><p>信息披露</p><span onclick="location.href='/getWchatInfoDisclosureByPid.do?pid=${productDetailMap.pid}&productType=2'"><i class="icon-next"></i></span></li>
			</ul>
			<div class="useVoucher"><input class="checkBox" type='checkbox' name='VoteOption1' value=""><select id="voucherSelect">
							<option value="10" id="voucher10">
								投资抵用券 ￥30.00</option>
							<option value="3227" id="voucher3227">
								投资抵用券 ￥30.00</option>
							</select></div>
			<div class="money-input">
				<div class="login_input inv_input">
				<div class="r_line">
				<i class="icon-calc" onclick="showDetalDIv()"></i>
				</div>
				<div class="in_put"><input placeholder="购买金额/最低50元" id="idCard" name="idCard" maxlength="17" type="tel"></div>
				</div>
				<div class="box-bottom"><img src="/v3/images/box_icon.jpg"/></div>
			</div>
			<div class="Nxt-btn"><a href="#" onclick="javascript:checkRealName()">确认购买</a></div>
		</div>
		
		<!-- 计算收益值开始 -->
		<section class="zhezhao" id="zhezhao" style="position:fixed;bottom:0"></section>
		<input type="hidden" name="ptype" id="ptype" value="ylb">
		<aside class="zhezhao_div" id="showDiv">
			<div class="zhe_div" id="zhe">
				<div class="topzh" id="topzh">
					<div class="topzh_zhezhao" id="yeb" productCat="yeb">
						<p style="color:#fff">余额宝</p>
					</div>
					<div class="topzh_zhezhao act" id="ylb" productCat="ylb">
						<p>月利宝</p>
					</div>
					<div class="topzh_zhezhao" id="jfb" productCat="jfb">
						<p>季发宝</p>
					</div>
					<div class="topzh_zhezhao" id="wyb" productCat="wyb">
						<p>稳盈宝</p>
					</div>
				</div>
				<section class="zhezhao_ct">
					<div class="zhezhao_top"></div>
					<div class="zhezhao_td">
						<p>预期收益</p>
						<span id="shouyi">1250.0元</span>
					</div>
					<div class="zhezhao_thd">
						<div class="zhezhao_thd_od">
							<div class="zhezhao_di">
								<p>买入金额</p>
							</div>
							<div class="zhezhao_dt">
								<input type="text" id="input_sal" value="10000">
								<p>元</p>
							</div>
						</div>
						<div id="ct">
							<nav>
							<div class="zhezhao_thd_od">
								<div class="zhezhao_di">
									<p>买入天数</p>
								</div>
								<div class="zhezhao_dt">
									<input type="text" id="input_days" value="365" onblur="isNumber(this)" onchange="caluateProfit()">
									<p>天</p>
								</div>
							</div>
							</nav>
							<nav style="display:block">
							<div class="zhezhao_thd_od">
								<div class="zhezhao_di">
									<p>买入天数</p>
								</div>
								
								<div class="zhezhao_dt">
									<input type="hidden" value="ylb" id="productCat" name="productCat"/>
									<div class="dv">
										<p>30天</p>
									</div>
								</div>
							</div>
							</nav>
							<nav>
							<div class="zhezhao_thd_od">
								<div class = "zhezhao_di">
									<p>买入天数</p>
								</div>
								<div class="zhezhao_dt">
									<div class="dv">
										<p>90天</p>
									</div>
								</div>
							</div>
							</nav>
							<nav>
								<div class="zhezhao_thd_od">
								<div class="zhezhao_di">
									<p>买入天数</p>
								</div>
								<div class="zhezhao_dt">
									<input type="text" id="input_days2" value="365" onblur="isNumber(this)" onchange="caluateProfit()">
									<p>天</p>
								</div>
								</div>
							</nav>
						</div>
						<div class="zhezhao_thd_od" id="wyb-rate" style="display:none;">
							<div class="zhezhao_di">
								<p>年化利率</p>
							</div>
							<div class="zhezhao_dt">
								<input id="input_wybRate" value="12" type="text">
								<p>%</p>
							</div>
						</div>
						<div class="zhezhao_thd_od" id="wyb-repay" style="display:none;">
							<div class="zhezhao_di">
								<p>还款方式</p>
							</div>
							<div class="zhezhao_dt">
									<select name="" id="repayType">
										<option value="1">按月等额本息</option>
										<option value="2">按月还息到期还本</option>
										<option value="3">一次性还本付息</option>
									</select>
							</div>
						</div>

						<div class = "zhezhao_dv">
							<p>预期收益率:<b id="yuqi">7%</p>
						</div>
						<div>
							<input type="button" value="计算" class="calc_btn" id="sub" onclick="caluateAmount()"/>
							<input type="hidden" value="7" id="baseYield" name="baseYield"/>
						</div>
					</div>
				</section>
			</div>
			</aside> 
		<!-- 计算收益值结束 -->
		
		<jsp:include page="/include/v3/footer.jsp"></jsp:include>
	</body>
<script><!--
	    var lastptype="6";
	 	var lastproduct="6";
	 	var productCat=$("#ptype").val();
	 	var restMonthAmount=isNaN(parseFloat($("#restMonthAmount").val())) ? 0 : parseFloat($("#restMonthAmount").val());
	 	var flag=$("#flag").val();
		$(function (){
			var index;
			var id;
			var $div = $('nav');
			var $bt = $('.cln aside');
			var $ct = $('#ct nav');

			$('#topzh div').on('click',function (){
				index = $(this).index();
				$(this).addClass('topzh_zhezhao act').siblings().removeClass('act');
				$ct.eq(index).show().siblings().hide();
				$(this).find('p').css('color','#fff').parent().siblings().find('p').css('color','#a0a0a0');
				if(index==0){
					$("#yuqi").html("7%");
					$("#baseYield").val("7");
					$("#productCat").val("yeb");
					$("#input_days").val("365");
					$("#wyb-rate").hide();
					$("#wyb-repay").hide();
					$(".zhezhao_dv").show();
				    caluateProfit();
				}else if(index==1){
					$("#yuqi").html("9%");
					$("#baseYield").val("9");
					$("#productCat").val("ylb");
					$("#input_days").val("30");
					$("#wyb-rate").hide();
					$("#wyb-repay").hide();
					$(".zhezhao_dv").show();
					caluateAmount();
				}else if(index==2){
					$("#yuqi").html("11%");
					$("#baseYield").val("11");
					$("#productCat").val("jfb");
					$("#input_days").val("90");
					$("#wyb-rate").hide();
					$("#wyb-repay").hide();
					$(".zhezhao_dv").show();
					caluateAmount();
				}
				else{
					$("#baseYield").val($("#input_wybRate").val());
					$("#productCat").val("wyb");
					$("#input_days").val($("#input_days2").val());
					$("#wyb-rate").show();
					$("#wyb-repay").show();
					$(".zhezhao_dv").hide();
					caluateAmount();
				}
			});
		
		});

		function showDetalDIv(){
		    $("#zhezhao").show();
			$("#showDiv").show();
			$("#zhe").show();
			if(productCat=="yeb"){
				showCss(1);
			}else if(productCat=="ylb"){
				$("#yuqi").html("9%");
				$("#baseYield").val("9");
				$("#input_days").val("30");
				showCss(2);
			}else if(productCat=="jfb"){
				$("#yuqi").html("11%");
				$("#baseYield").val("11");
				$("#input_days").val("90");
				showCss(3);
			}
			else{
				$("#baseYield").val($("#input_wybRate").val());
				$("#input_days").val($("#input_days2").val());
				showCss(4);
			}
			caluateAmount();
		}
		function showCss(index){
			var selector=".topzh div:nth-child("+index+")";
			var selectIndex="#ct nav:nth-child("+index+")";
			$(selector).addClass('topzh_zhezhao act').siblings().removeClass('act');
			$(selectIndex).show().siblings().hide();
			$(selector).find('p').css('color','#fff').parent().siblings().find('p').css('color','#a0a0a0');
		}
		function caluateAmount() {
			var productCat=$("#productCat").val();
			if(productCat=="wyb"){
				var input_days=$("#input_days2").val();
				var input_sal=$("#input_sal").val();
				var baseYield=$("#input_wybRate").val();
			}
			else{
			var input_days=$("#input_days").val();
			var input_sal=$("#input_sal").val();
			var baseYield=$("#baseYield").val();
			}
		    if(isNumber(input_days)&&isNumber(input_sal)){
			    var shouyi=(input_sal*input_days*(parseFloat(baseYield))/100/365).toFixed(2);
			    $("#shouyi").html(shouyi);
		    }
	   }
		function caluateProfit(){
		var productCat=$("#productCat").val();
		if(productCat=="yeb"){
		var url="/statistic/caluateProfit.html";
		var days=$("#input_days").val();
		  $.get(url,{"days":days},function (data){
				if(data!=null){
					$("#yuqi").html(data);
					$("#baseYield").val(data);	
					caluateAmount();
				}
			});
			 
			}
		} 
		
		//稳盈宝-等额本息
function getData() {
    var type = $.trim($("#repayType").val());
    var amount = $.trim($("#input_sal").val());
    var reg = /^[0-9]*[1-9][0-9]*$/;
    var newPar = /^\d+(\.\d+)?$/;
    if (!reg.test(amount)) {
        return;
    };
    var ann = $.trim($("#input_wybRate").val());
    var count = $.trim($("#input_days2").val());
    if (!newPar.test(ann)) {
        return;
    };
    if (!reg.test(count)) {
        return;
    };
    if (count > 120) {
        return;
    };
    function Data() {
        this.phaseNumber=0;//月份
        this.plannedTermAmount=0;//月收本息
        this.plannedTermInterest=0;//利息
        this.plannedTermPrinciple=0;//月收本金
        this.termRemainingPrincipal=0;//本金余额
    }
    var dataArr = new Array();
    var param = {};
    param["paramMap.borrowSum"] = amount;
    param["paramMap.yearRate"] = ann;
    param["paramMap.borrowTime"] = count;
    param["paramMap.repayWay"] = type;
    $.ajax({
        url: environment.basePath+'/frontfinanceTools.do',
        data: param,
        type: 'POST',
        dataType: 'json',
        beforeSend: function() {
    
        },
        success: function(data) {
        	for(var i = 0; i < data.length; i ++){
    		 var temp = new Data();
		     temp.phaseNumber = data[i].mon;
		     temp.plannedTermPrinciple = data[i].monForA;//月收本金
		     temp.termRemainingPrincipal = data[i].sumRemain;//本金余额
		     temp.plannedTermAmount = data[i].monForRateA;//月收本息
		     temp.plannedTermInterest = data[i].monForRate;//利息
		     dataArr.push(temp);
        	}
        },
        error: function() {
        }
    });
};
//稳盈宝-按月还息到期还本
function getData2() {
    var type = $.trim($("#repayType").val());
    var amount = $.trim($("#investAmount").val());
    var reg = /^[0-9]*[1-9][0-9]*$/;
    var newPar = /^\d+(\.\d+)?$/;
    if (!reg.test(amount)) {
        return;
    };
    var ann = $.trim($("#anun").val());
    var count = $.trim($("#investTime").val());
    if (!newPar.test(ann)) {
        return;
    };
    if (!reg.test(count)) {
        return;
    };
    if (count > 120) {
        return;
    };
    function Data() {
        this.phaseNumber=0;//月份
        this.plannedTermAmount=0;//月收本息
        this.plannedTermInterest=0;//利息
        this.plannedTermPrinciple=0;//月收本金
        this.termRemainingPrincipal=0;//本金余额
    }
    var dataArr = new Array();
    var param = {};
    param["paramMap.borrowSum"] = amount;
    param["paramMap.yearRate"] = ann;
    param["paramMap.borrowTime"] = count;
    param["paramMap.repayWay"] = type;
    $.ajax({
        url: environment.basePath+'/frontfinanceTools.do',
        data: param,
        type: 'POST',
        dataType: 'json',
        beforeSend: function() {
    
        },
        success: function(data) {
        	for(var i = 0; i < data.length; i ++){
    		 var temp = new Data();
		     temp.phaseNumber = data[i].mon;
		     temp.plannedTermPrinciple = data[i].monForA;//月收本金
		     temp.termRemainingPrincipal = data[i].sumRemain;//本金余额
		     temp.plannedTermAmount = data[i].monForRateA;//月收本息
		     temp.plannedTermInterest = data[i].monForRate;//利息
		     dataArr.push(temp);
        	}
        },
        error: function() {
        }
    });
};
//稳盈宝-一次性还本付息
function getData3(){
    var amount = $.trim($("#investAmount").val());
    var reg = /^[0-9]*[1-9][0-9]*$/;
    var newPar = /^\d+(\.\d+)?$/;
    if (!reg.test(amount)) {
        return;
    };
    var ann = $.trim($("#anun").val());
    var count = $.trim($("#investTime").val());
    if (!newPar.test(ann)) {
        return;
    };
    if (!reg.test(count)) {
        return;
    };
    if (count > 120) {
        return;
    };

    function Data() {
        this.phaseNumber=0;
        this.plannedTermAmount=0;
        this.plannedTermInterest=0;
        this.plannedTermPrinciple=0;
        this.termRemainingPrincipal=0;
    }
    var monAnn = ann/(12*100);
    var dataArr = new Array();
    for(var i=0;i<count;i++){
        var temp = new Data();
        if(i == count-1){
        	temp.plannedTermPrinciple = Number(0);
        	temp.termRemainingPrincipal = Number(0);
        	temp.plannedTermAmount = Number(amount) + Number((amount * monAnn * count).toFixed(2));
        	temp.phaseNumber = i+1;
        	temp.plannedTermInterest = (amount * monAnn * count).toFixed(2);
        }else{
        	temp.plannedTermPrinciple = Number(0);
        	temp.termRemainingPrincipal = Number(amount);
        	temp.plannedTermAmount = Number(0);
        	temp.phaseNumber = i+1;
        	temp.plannedTermInterest = Number(0);
        }
        dataArr.push(temp);
    }
}
		//关闭弹出层
		$("#zhezhao2").click(function(){
		 	$("#zhezhao").hide();
			$("#showDiv").hide();
			$("#zhe").hide();
		});
		$("#zhe2").click(function(){
		 	$("#zhezhao").hide();
			$("#showDiv").hide();
			$("#zhe").hide();
		});
		$("#zhezhao").click(function (){
			zhezhao.style.display = "none";
			showDiv.style.display = "none";
			zhe.style.display = "none";
		});
		function isNumber(oNum) {  
	    if (!oNum)  
	        return false;  
	    var strP = /^\d+(\.\d+)?$/;  
	    if (!strP.test(oNum))  
	        return false;  
	    try {  
	        if (parseFloat(oNum) != oNum)  
	            return false;  
	    } catch (ex) {  
	        return false;  
	    }  
	    return true;  
	}
	--></script>

</html>
